<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<%@ include file="../common/top_css.jsp"%>
<script src="${pageContext.request.contextPath}/bootstrap/js/jquery.js"></script> <!-- jQuery -->
<script type="text/javascript">
	$(function(){
			$.ajax({
				url : "${pageContext.request.contextPath}/order/selectOrderList.action",
				type : "POST",
				dataType : "json", 
				data : {},
				success : function(result, start, resp) {
					var str='';
					for ( var i = 0; i < result.length; i++) {
						if(result[i].type==111){
							str+='<tr><td>'
							+result[i].ordernum+'</td><td>'
							+result[i].supplier.name+'</td><td>'
							+result[i].creater.name+'</td><td>'
							+result[i].createTimeView+'</td><td>'
							+result[i].totalnum+'</td><td>'
							+result[i].totalPriceView+'</td><td><a href="${pageContext.request.contextPath}/order/selectOrderDeteil2.action?uuid='
							+result[i].uuid+'">审核</a></td></tr>';	
						}else{
							str+='<tr><td>'
							+result[i].ordernum+'</td><td>'
							+result[i].supplier.name+'</td><td>'
							+result[i].creater.name+'</td><td>'
							+result[i].createTimeView+'</td><td>'
							+result[i].totalnum+'</td><td>'
							+result[i].totalPriceView+'</td><td>'
							+result[i].typeView+'</td></tr>';
						}
					}
					$("#tables").append(str);
				}
			});
		
			$("#search").click(function(){
				var type=$("select[name='type']").val();
				var name=$("input[name='name']").val();
				var createTimeViewMin=$("input[name='createTimeViewMin']").val();
				var createTimeViewMax=$("input[name='createTimeViewMax']").val();
				var totalnumMin=$("input[name='totalnumMin']").val();
				var totalnumMax=$("input[name='totalnumMax']").val();
				var totalpriceMin=$("input[name='totalpriceMin']").val();
				var totalpriceMax=$("input[name='totalpriceMax']").val();
				$.ajax({
					url : "${pageContext.request.contextPath}/order/selectOrderList.action",
					type : "POST",
					dataType : "json", 
					data : {"type":type,"name":name,"createTimeViewMin":createTimeViewMin,"createTimeViewMax":createTimeViewMax,"totalnumMin":totalnumMin,"totalnumMax":totalnumMax,"totalpriceMin":totalpriceMin,"totalpriceMax":totalpriceMax},
					success : function(result, start, resp) {
						var str='';
						for ( var i = 0; i < result.length; i++) {
							if(result[i].type==111){
								str+='<tr><td>'
								+result[i].ordernum+'</td><td>'
								+result[i].supplier.name+'</td><td>'
								+result[i].creater.name+'</td><td>'
								+result[i].createTimeView+'</td><td>'
								+result[i].totalnum+'</td><td>'
								+result[i].totalPriceView+'</td><td><a href="${pageContext.request.contextPath}/order/selectOrderDeteil2.action?uuid='
								+result[i].uuid+'">审核</a></td></tr>';	
							}else{
								str+='<tr><td>'
								+result[i].ordernum+'</td><td>'
								+result[i].supplier.name+'</td><td>'
								+result[i].creater.name+'</td><td>'
								+result[i].createTimeView+'</td><td>'
								+result[i].totalnum+'</td><td>'
								+result[i].totalPriceView+'</td><td>'
								+result[i].typeView+'</td></tr>';
							}
						}
						$("#tdAdd").empty();
						$("#tables").append(str);
					}
				});
			});
	});
	

</script>

</head>

<body>
	<div class="navbar navbar-fixed-top bs-docs-nav" role="banner">
		<div class="conjtainer">
  			<%@ include file="../common/top_nav.jsp" %>
		</div>
	</div>

	<%@ include file="../common/top.jsp" %>
	<div class="content">
		<%@ include file="../common/left.jsp" %>
		<div class="mainbar">
		<%@ include file="../common/page-head.jsp" %>
			<div class="matter">
				<div class="container">
				<!-- 内容开始 -->
					<!-- 表单 -->
					<div class="widget wgreen">
		                <div class="widget-head">
		                  <div class="pull-left">搜索</div>
		                  <div class="widget-icons pull-right">
		                    <a href="#" class="wminimize"><i class="icon-chevron-up"></i></a> 
		                    <a href="#" class="wclose"><i class="icon-remove"></i></a>
		                  </div>
		                  <div class="clearfix"></div>
		                </div>
		                <div class="widget-content">
		                  <div class="padd">
		                    <!-- Form starts.  -->
		                     <form class="form-horizontal" role="form">
		                              
		                                <div class="form-group">
		                                 
		                                  <label class="col-lg-2 control-label">制单人</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="name" placeholder="制单人" type="text">
		                                  </div>
		                                </div>
		                                <div class="form-group">
		                                  <label class="col-lg-2 control-label">下单时间</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="createTimeViewMin" placeholder="年-月-日" type="text">
		                                  </div>
		                                  <label class="col-lg-2 control-label">到</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="createTimeViewMax" placeholder="年-月-日" type="text">
		                                  </div>
		                                </div> 
		                                <div class="form-group">
		                                  <label class="col-lg-2 control-label">总量</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="totalnumMin" placeholder="总量" type="text">
		                                  </div>
		                                  <label class="col-lg-2 control-label">到</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="totalnumMax" placeholder="总量" type="text">
		                                  </div>
		                                </div>
		                                <div class="form-group">
		                                  <label class="col-lg-2 control-label">总额</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="totalpriceMin" placeholder="总额" type="text">
		                                  </div>
		                                  <label class="col-lg-2 control-label">到</label>
		                                  <div class="col-lg-4">
		                                    <input class="form-control" name="totalpriceMax" placeholder="总额" type="text">
		                                  </div>
		                                </div>    
		                                <hr>
		                                <div class="form-group">
		                                  <div class="col-lg-offset-1 col-lg-9">
		                                    <button type="button" id="search" class="btn btn-success">Search</button>
		                                  </div>
		                                </div>
		                              </form>
		                  </div>
		                </div>
		                  <div class="widget-foot">
		                    <!-- Footer goes here -->
		                  </div>
		              </div>	
					<!-- 表格 -->
					<div class="widget">
		                <div class="widget-head">
		                  <div class="pull-left">供应商列表</div>
		                  <div class="widget-icons pull-right">
		                    <a href="#" class="wminimize"><i class="icon-chevron-up"></i></a> 
		                    <a href="#" class="wclose"><i class="icon-remove"></i></a>
		                  </div>  
		                  <div class="clearfix"></div>
		                </div>
		                <div class="widget-content">
			                <table class="table table-striped table-bordered table-hover" id="tables">
			                      <thead>
			                        <tr>
			                          <th>订单号</th>
			                          <th>供应商</th>
			                          <th>制单人</th>
			                          <th>制单时间</th>
			                          <th>订单商品总量</th>
			                          <th>订单总金额</th>
			                          <th>订单状态</th>
			                        </tr>
			                      </thead>
			                      <tbody id="tdAdd">
			                      </tbody>
			                    </table>
		                    <div class="widget-foot">
		                        <ul class="pagination pull-right">
		                          <li><a href="#">Prev</a></li>
		                          <li><a href="#">1</a></li>
		                          <li><a href="#">2</a></li>
		                          <li><a href="#">3</a></li>
		                          <li><a href="#">4</a></li>
		                          <li><a href="#">Next</a></li>
		                        </ul>
		                      <div class="clearfix"></div> 
		                    </div>
		
		                </div>
		
	                </div>
				
				
				<!-- 内容结束 -->
				</div>
			</div>
		</div>
	</div>
	<%@ include file="../common/footer.jsp" %>
 	<%@ include file="../common/footer_js.jsp" %>
</body>
</html>
